package com.inca;

import java.io.File;

import ws.schild.jave.Encoder;
import ws.schild.jave.MultimediaObject;
import ws.schild.jave.encode.AudioAttributes;
import ws.schild.jave.encode.EncodingAttributes;

public class Convertmp3 {
	static void convert()throws Exception{
		File source=new File("D:\\npserver63ws\\npserver63\\recording.wav");
		File target=new File("out.mp3");
		
		 AudioAttributes audio = new AudioAttributes();
		    audio.setCodec("libmp3lame");
		    audio.setBitRate(128000);
		    audio.setChannels(2);
		    audio.setSamplingRate(44100);

		    EncodingAttributes attrs = new EncodingAttributes();
		    attrs.setOutputFormat("mp3");
		    attrs.setAudioAttributes(audio);

		    Encoder encoder = new Encoder();
		    encoder.encode(new MultimediaObject(source), target, attrs);
	}
	
	public static void main(String[] args) {
		try {
			convert();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
